//
//  XHRApplyFamousDoctorViewController.m
//  快医
//
//  Created by 胥鸿儒 on 16/7/6.
//
//

#import "XHRApplyFamousDoctorViewController.h"
#import "WWAppliersModel.h"
#import "WWAppliersCell.h"
#import "SYTableViewController.h"
@interface XHRApplyFamousDoctorViewController ()

@property (nonatomic, strong)NSArray *appliers;

@end

@implementation XHRApplyFamousDoctorViewController

#pragma
#pragma mark -lazy
- (NSArray *)appliers{
    
    if (nil == _appliers) {
        _appliers = [WWAppliersModel getAppliersModel];
    }
    return _appliers;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];

    [self.tableView registerClass:[WWAppliersCell class] forCellReuseIdentifier:@"appliers"];
    
    self.tableView.tableFooterView = [UIView new];
}

#pragma
#pragma mark -代理
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.appliers.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    WWAppliersCell *cell = [tableView dequeueReusableCellWithIdentifier:@"appliers" forIndexPath:indexPath];
    
    WWAppliersModel *model = self.appliers[indexPath.row];
    
    cell.model = model;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

    // MARK:  选择某一行时跳转
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath{

    // 取出model
    WWAppliersModel *model = self.appliers[indexPath.row];
    
    // 跳转到下一个页面
    SYTableViewController  *syTVC= [SYTableViewController new];
    
    // 给页面的 model赋值
    
    syTVC.model = model;
    
    
    [self.navigationController pushViewController:syTVC animated:YES];
}


- (void)ddReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
// 返回行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 70;

}

@end
